home *** CD-ROM | disk | FTP | other *** search
- Path: druid.borland.com!usenet
- From: pete@borland.com (Pete Becker)
- Newsgroups: comp.lang.c++
- Subject: Re: MS VC++ 4.0 namespace weirdness
- Date: 20 Mar 1996 15:46:15 GMT
- Organization: Borland International
- Message-ID: <4ip987$aj5@druid.borland.com>
- References: <314D9E46.433@lydian.lc.att.com>
- NNTP-Posting-Host: pbecker.borland.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=ISO-8859-1
- X-Newsreader: WinVN 0.99.5
-
- In article <314D9E46.433@lydian.lc.att.com>, shaw@lydian.lc.att.com says...
- >
- >[Hope this is the right group -- didn't see a VC++-specific one]
- >
- >If I define a namespace in an include file, the classes within
- >that
- >namespace are not recognized by the MS VC++ 4.0 class window.
- >If I
- >define the namespace in the including file, they are. Any
- >opinions
- >on this anomaly?
- >
- > Thanks,
- > andrew.shaw@att.com
- >
- >Example:
- >
- >// foo1.hpp
- >namespace FOO1
- >{
- >class X1 { int x1; };
- >}
- >
- >// foo2.hpp
- >class X2 { int x2; };
- >
- >// foo.cpp
- >#include "foo1.hpp" // whereis FOO1::X1?
- >namespace FOO2
- >{
- >#include "foo2.hpp" // FOO2::X2 no problem
- >}
-
- Don't do this. I know, Microsoft recommends this as the technique for getting
- the public domain version of STL that they slapped onto their CD into a
- namespace. Bottom line is it doesn't work, and it will cause endless problems.
- If the header wasn't written with namespaces in mind don't try to force it into
- a namespace. Namespaces are not something you throw in, they're something you
- design in. If the design isn't there it's not going to work.
-
-